package com.ssy.lingxi.report.api.enums;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 * 销售订单操作类型枚举
 * @author 伍将
 * @date 2020/11/18
 * @version 2.0.0
 */
public enum SaleOrderOperateTypeEnum {

    /**
     * 待提交审核订单
     */
    TO_BE_VALIFY_COMMIT(1, "待提交审核订单", "/memberCenter/order/saleOrder/readyApprovedOrder"),
    /**
     * 待审核订单（一级）
     */
    TO_BE_VALIFY_STEP1(2, "待审核订单（一级）", "/memberCenter/order/saleOrder/firstApprovedOrder"),
    /**
     * 待审核订单（二级）
     */
    TO_BE_VALIFY_STEP2(3, "待审核订单（二级）", "/memberCenter/order/saleOrder/secondApprovedOrder"),
    /**
     * 待确认订单
     */
    TO_BE_CONFIRM(4, "待确认订单", "/memberCenter/order/saleOrder/readyConfirmOrder"),
    /**
     * 待确认支付结果订单
     */
    TO_BE_CONFIRM_PAY_RESULT(5, "待确认支付结果订单", "/memberCenter/order/saleOrder/readyPayResult"),
    /**
     * 待新增销售发货单订单
     */
    TO_BE_ADD_DELIVERY_GOODS(6, "待新增销售发货单订单", "/memberCenter/order/saleOrder/addSaleDelevedOrder"),
    /**
     * 待新增物流单订单
     */
    TO_BE_ADD_LOGISTICS(7, "待新增物流单订单", "/memberCenter/order/saleOrder/readyAddLogisticsOrder"),
    /**
     * 待确认发货订单
     */
    TO_BE_CONFIRM_DELIVERY_GOODS(8, "待确认发货订单", "/memberCenter/order/saleOrder/readyConfirmDelevedOrder"),
    /**
     * 待确认回单订单
     */
    TO_BE_CONFIRM_RECEIPT(9, "待确认回单订单", "/memberCenter/order/saleOrder/readyConfirmReturnOrder"),
    /**
     * 待归档订单
     */
    TO_BE_ARCHIVE(10, "待归档订单", "/memberCenter/order/saleOrder/readyReturnDocument"),
    /**
     * 待评价订单
     */
    TO_BE_EVALUATE(11, "待评价订单", "/memberCenter/order/supplierEvaluation/unevaluated");

    /**
     * 编码
     */
    private final Integer code;
    /**
     * 名称
     */
    private final String name;
    /**
     * 链接
     */
    private final String link;


    SaleOrderOperateTypeEnum(Integer code, String name, String link) {
        this.code = code;
        this.name = name;
        this.link = link;
    }

    public static SaleOrderOperateTypeEnum getEnum(Integer code) {
        return Arrays.stream(SaleOrderOperateTypeEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(null);
    }


    public Integer getCode() {
        return code;
    }

    public String getName() {
        return LanguageHolder.getName(this.getClass(), this.code);
    }

    public String getLink() {
        return link;
    }
}
